<?php
/**
 * Whisper class, whisper a message to a char on same room
 * @package action
 * @author alcaitiff
 */
class Whisper implements Action{
   	/**
     * @static
     * @var integer
     **/
	static private $tick;
    /**
     * @static
     * @var Char
     **/
	static private $char;
	/**
    *	Usage: whisper string [string]*
	*
	* @static
    * @param Command $command Command
    * @param int $tick Tick
    * @return String This command will return the message
    */
	static public function run($command,$tick){
		self::$tick=$tick;
		self::$char=$command->character;
        $parameters=$command->parameters;
        $el=self::$char->getChar($parameters[0],1);
        if($el instanceof  Char){
            unset($parameters[0]);
            $msg=implode(' ',$parameters);
            MessageSystem::addCharacterMessage(self::$char->charId.' whisper to you:'.$msg,$el->charId);
            MessageSystem::addCharacterMessage('You whisper to '.$el->charId.':'.$msg);
        }
	}

}